#ifndef PURG_COMBINED_GENERATOR_H
#define PURG_COMBINED_GENERATOR_H

#include "buffer.h"

#ifndef PURG_C_INTERFACE_COMPILE
namespace purg
{
#endif


  template <typename GEN1_FCN , typename GEN2_FCN>
  class combined_generator_tmpl
  {
    public:
      typedef  GEN1_FCN             gen1;
      typedef  GEN2_FCN             gen2;

    private:
      typedef  typename gen1::state       gen1_state;
      typedef  typename gen1::seed        gen1_seed;
      typedef  typename gen2::state       gen2_state;
      typedef  typename gen2::seed        gen2_seed;

      gen1_state         _gen1_state;
      buffer             _gen1_buffer;
      size_t             _gen1_offset;

      gen2_state         _gen2_state;
      buffer             _gen2_buffer;
      size_t             _gen2_offset;

      size_t             _generator_id;


    protected:
      void           lock ();
      void           unlock ();

    public:
      combined_generator_tmpl ( gen1_seed seed1 , gen2_seed seed2 , size_t generator_id );

      void           get ( double & );
      void           get ( float & );

      void           get ( double & , double , double );
      void           get ( float & , float , float );

      template <typename POD_TYPE>
      void           get ( POD_TYPE &buffer );

      template <typename POD_TYPE>
      void           get ( POD_TYPE &buffer , POD_TYPE minimum , POD_TYPE maximum );

      gen1_state         &get_gen1_state ();
      gen2_state         &get_gen2_state ();

      void           get_raw_buffer ( size_t length , void *buffer );
  };

#ifndef PURG_C_INTERFACE_COMPILE
}
#endif

#include "combined_generator.tmpl.h"

#endif
